/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package framework.view;

import framework.model.Factory;
import java.awt.BorderLayout;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.table.AbstractTableModel;

/**
 *
 * @author ThanhNguyen
 */
public class TablePanel extends JPanel {

    private JTable table;
    private AbstractTableModel model;

    public JTable getTable() {
        return table;
    }

    public TablePanel() {
        setBounds(0, 50, 475, 260);
        setLayout(new BorderLayout(0, 0));
        JScrollPane jScrollPane = new JScrollPane();
        table = new JTable();
        Factory factory = Factory.getInstance();
        model = factory.createAccountTableModel();
        table.setModel(model);
        table.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        jScrollPane.setViewportView(table);
        add(jScrollPane, BorderLayout.CENTER);
    }

    public void update() {
        model.fireTableDataChanged();
    }
}
